<?php
$this->breadcrumbs=array(
	'Borrow',
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
    $('.search-form').toggle();
    return false;
});
$('.search-form form').submit(function(){
    $.fn.yiiGridView.update('machine-grid', {
        data: $(this).serialize()
    });
    return false;
});
");
?>

<h1><?php echo $this->id . '/' . $this->action->id; ?></h1>



<?php echo CHtml::link('Advanced Search','#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
	'model'=>$machineModel,
)); ?>

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'machine-grid',
	'dataProvider'=>$machineModel->search(),
	'filter'=>$machineModel,
	'columns'=>array(
        array(
            'class'=>'CCheckBoxColumn',
            'id'=>'id'),

		'id',
		'hostname',
		//'aliasname',
		//'ip',
		array(
            'name' => 'conn',
            'value' => '$data->conn==1?"OK":"Lost"',
        ),
		array(
            'name' => 'workgroup',
            'value' => 'CActiveRecord::model(\'Workgroup\')->find(\'id=\'.$data->workgroup)->groupname',
        ),
        //'workgroup',
		array(
            'name' => 'isentity',
            'value' => '$data->isentity==1?"实体机":"虚拟机"',
        ),
		array(
            'name' => 'handle',
            'value' => 'CActiveRecord::model(\'Handle\')->find(\'id=\'.$data->handle)->handlename',
        ),
		'cpu',
        'mem',
        'disk',
        'network',
        'os',
		'remark',
         array(
            'name' => 'available',
            'value' => '$data->isentity==1?"已借出":"空闲"',
        ),
        array(
            'class' => 'CButtonColumn',
            'header' => '详情',
            'template' => '{view}',
        ),
	),
)); ?>